package demo2;

//牛客网:点击消除

import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        StringBuffer str = new StringBuffer(scanner.nextLine());
        int i = 0;
        while(i<str.length()) {
            int j = i+1;
            if(j < str.length() && str.charAt(i) == str.charAt(j)) {
                str.delete(i,j+1);
                i--;
                if(i == -1) {
                    i = 0;
                }
            }else {
                i = j;
            }
        }
        if(str.length() == 0) {
            System.out.println(0);
        }else {
            System.out.println(str);
        }
    }
}